#!/bin/sh

i=1
echo "please input the name of group that you want to delete:"
read grpname

tmpfile="$grpname.txt"

sudo ls /usr/myftp/$grpname > /usr/myftp/$grpname/$tmpfile
cd /usr/myftp/$grpname

while read LINE;
do
	if [ $i -ge 2 ]
	then
		sudo userdel -r $LINE
	fi
	i=$(($i+1))
done < $tmpfile

sudo groupdel $grpname
sudo rm -rf /usr/myftp/$grpname

exit 0
